package com.samphanie.auiu.biz_home.api

import com.samphanie.auiu.common.http.ApiFactory
import com.samphanie.auiu.library.restful.AuiuCall
import com.samphanie.auiu.library.restful.annotation.CacheStrategy
import com.samphanie.auiu.library.restful.annotation.Filed
import com.samphanie.auiu.library.restful.annotation.Get
import com.samphanie.auiu.library.restful.annotation.Path
import com.samphanie.auiu.biz_home.model.HomeModel
import com.samphanie.auiu.biz_home.model.TabCategory

/**
 * @author Dries
 **/
interface HomeApi {

    @CacheStrategy(CacheStrategy.CACHE_FIRST)
    @Get("/auiu-app/v1/open_api/home/category/tabs")
    fun queryTabList() : AuiuCall<List<TabCategory>>

    @Get("/auiu-app/v1/open_api/home/{cateId}/list")
    fun queryTabCategoryList(
        @CacheStrategy cacheStrategy: Int,
        @Path("cateId") cateId: String,
        @Filed("pageNum") pageNum: Int,
        @Filed("pageSize") pageSize: Int
    ) : AuiuCall<HomeModel>

    companion object {
        fun create(): HomeApi {
            return ApiFactory.create(HomeApi::class.java)
        }
    }
}

fun homeApiService(): HomeApi {
    return HomeApi.create()
}